/**
 * Created by liqiao on 2017/11/27.
 */
import {Injectable} from '@angular/core';
import {Http, ResponseContentType}from '@angular/http';
import 'rxjs/add/operator/map';
import { environment } from '../../environments/environment'

@Injectable()
export class AccountRecordService {
    url: string;

    constructor(public http: Http) {
        this.url = environment.host + ":" + environment.port;
    }

    getAccountRecord() {
        // return this.http.get("http://jsonplaceholder.typicode.com/users")
        return this.http.get(this.url + "/userAccountRecord")
            .map(res => res.json());

    }

    findByUserNo(userNo) {
        return this.http.get(this.url + "/userAccountRecord/findByUserNo/" + userNo)
            .map(res => res.json());
    }

    findByUserName(userName) {
        return this.http.get(this.url + "/userAccountRecord/findByUserName/" + userName)
            .map(res => res.json());
    }

    addAccountRecord(AccountRecord) {
        return this.http.post(this.url + "/userAccountRecord/add", AccountRecord)
            .map(res => res.json());
    }

    deleteAccountRecord(id){
        return this.http.get(this.url + "/userAccountRecord/delete/"+id)
            .map(res => res.json());
    }
}
